import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.MouseEvent;
import javax.swing.*;


public class HelloWorld {
JFrame window;
testPanel panel1, panel2; 

public HelloWorld(String title){
	window = new JFrame(title);
	panel2 = new testPanel(Color.BLACK);
	panel1 = new testPanel(Color.BLUE);
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	window.add(panel1,BorderLayout.NORTH);
	window.add(panel2,BorderLayout.CENTER);
	window.setVisible(true);
	window.pack();
	}	
}
class HelloWorldApp {
	
public static void main(String[] args) {
	HelloWorld app = new HelloWorld("SWING!");

	}
}

class testPanel extends JPanel {
	testButton b1, b2;
	
	public testPanel(Color background){
		b1 = new testButton("HOVER 1");
		b2 = new testButton("HOVER 2");
		this.setBackground(background);
		this.add(b1);
		add(b2);
		b1.setLocation(600,600);
		
	}
}
class testButton extends JButton {
	int colorChange;
	public testButton(String label) {
		super(label);
		this.setSize(500, 500);
		colorChange = 0;
	}
		
		public void processMouseEvent(MouseEvent click){
			if (colorChange % 4 == 0) {
				this.setBackground(Color.GREEN);
				this.setText("LEARN");}
			else if (colorChange % 4 == 1) {
				this.setBackground(Color.red);
				this.setText("MOUSE");
			}
			else if (colorChange % 4 == 2) {
				this.setBackground(Color.YELLOW);
				this.setText("EVENT");
			}
			else if (colorChange % 4 == 3) {
				this.setBackground(Color.ORANGE);
				this.setText("E!");
			}
			colorChange++;
		}
}